import request from '@/utils/request.js'

// 滑动验证
export const loginTencentCaptcha = ({ ticket, userIp, randstr }) => {
  return request.post('/login/tencentcaptcha', { ticket, userIp, randstr })
}

// 手机号和密码登录
export const loginUserLogin = ({ employeePhoneNumber, loginPassword }) => {
  return request.post('/login/userlogin', { employeePhoneNumber, loginPassword })
}

// 发送验证码
export const loginSendCode = ({ employeePhoneNumber }) => {
  return request.get('/login/sendcode', { params: { employeePhoneNumber } })
}

// 验证码登录
export const loginCodeLogin = ({ employeePhoneNumber, codeval }) => {
  return request.post('/login/codelogin', { employeePhoneNumber, codeval })
}

// 导航列表
export const navigetionNavigationList = () => {
  return request.get('/navigetion/navigation-list')
}

// 获取所有商品分类
export const goodsAllCategory = () => {
  return request.get('/goods/allcategory')
}

// 图片上传
export const fileUploadFile = ({ file }) => {
  return request.post('/file/uploadfile', { file })
}

// 获取图片合集
export const filePictureset = ({ page }) => {
  return request.get('/file/pictureset', { params: { page } })
}

// 发布商品
export const goodsAddGoods = ({ category_id, goods_image, goods_describe, goods_name, goods_stats, hasSpecs }) => {
  return request.post('/goods/addgoods', { category_id, goods_image, goods_describe, goods_name, goods_stats, hasSpecs })
}

// tab筛选商品
export const goodsGetFilterProducts = () => {
  return request.get('/goods/getfilterproducts')
}

// 所有商品分类以及分类下的商品数量
export const goodsGetCategory = () => {
  return request.get('/goods/getcategory')
}

// 筛选商品数据
export const goodsGetGoods = ({ filterval, categoryid, page }) => {
  return request.get('/goods/getgoods', { params: { filterval, categoryid, page } })
}

// 下架商品
export const goodsHandleOfflineProducts = ({ goodsid }) => {
  return request.get('/goods/handle-offline-products', { params: { goodsid } })
}

// 上架商品
export const goodsHandleOnlineProducts = ({ goodsid }) => {
  return request.get('/goods/handle-online-products', { params: { goodsid } })
}

// 删除商品
export const goodsDeleteProducts = ({ goodsid }) => {
  return request.get('/goods/delete-products', { params: { goodsid } })
}

// 编辑商品
export const goodsEditProduct = ({ goods_id, category_id, goods_image, goods_describe, goods_name, goods_stats, hasSpecs }) => {
  return request.post('/goods/edit-product', { goods_id, category_id, goods_image, goods_describe, goods_name, goods_stats, hasSpecs })
}

// 上传商品分类
export const fileUploadCategory = ({ categoryName, icon }) => {
  return request.post('/file/uploadcategory', { categoryName, icon })
}

// 堂食点餐页面请求所有商品分类
export const goodsOrderForCategory = () => {
  return request.get('/goods/order-for-category')
}

// 堂食点餐页面请求所有商品数据
export const goodsOrderForProduct = ({ categoryid, page }) => {
  return request.get('/goods/order-for-product', { params: { categoryid, page } })
}

// 堂食点餐页面提交订单
export const orderCreateOrder = ({ diningPartySize, tableNumber, paymentMethod, productOrder }) => {
  return request.post('/order/create-order', { diningPartySize, tableNumber, paymentMethod, productOrder })
}

// 订单页面查询订单数据
export const orderQueryOrder = ({ orderTime, orderNumber, paymentMethod, tableNumber, diningPartySize, page }) => {
  return request.post('/order/query-order', { orderTime, orderNumber, paymentMethod, tableNumber, diningPartySize, page })
}

// 查询单个订单详情
export const orderQueryItemOrder = ({ goods_id }) => {
  return request.get('/order/query-item-order', { params: { goods_id } })
}

// 查询员工数据列表
export const userinfoEmployeeList = ({ employeeName, employeeId, employeePhoneNumber, page }) => {
  return request.post('/userinfo/employee-list', { employeeName, employeeId, employeePhoneNumber, page })
}

// 拉黑员工账号
export const userinfoBlockUserAccount = ({ userId }) => {
  return request.get('/userinfo/block-user-account', { params: { userId } })
}

// 移除黑名单
export const userinfoUnblockUser = ({ userId }) => {
  return request.get('/userinfo/unblock-user', { params: { userId } })
}

// 创建员工账号
export const userinfoCreateEmployeeAccount = ({ employeeId, employeeName, employeePhoneNumber, employeeRole, employeeGender, maritalStatus, birthdays, hireDate, loginPassword }) => {
  return request.post('/userinfo/create-employee-account', { employeeId, employeeName, employeePhoneNumber, employeeRole, employeeGender, maritalStatus, birthdays, hireDate, loginPassword })
}

// 获取员工职位数据
export const userinfoEmployeeRole = () => {
  return request.get('/userinfo/employee-role')
}

// 获取员工性别
export const userinfoEmployeeGender = () => {
  return request.get('/userinfo/employee-gender')
}

// 员工婚姻状况
export const userinfoMaritalStatus = () => {
  return request.get('/userinfo/marital-status')
}

// 经营概况
export const dataBusinessAnalysis = () => {
  return request.get('/data/business-analysis')
}

// 销售额趋势
export const dataSalesDrend = ({ queryTime }) => {
  return request.post('/data/sales-drend', { queryTime })
}

// 热销商品排名
export const dataHotSellingProducts = () => {
  return request.get('/data/hot-selling-products')
}

// 支付渠道排名
export const dataPaymentMethodRanking = () => {
  return request.get('/data/payment-method-ranking')
}

// 热门商品分类
export const dataPopularCategories = () => {
  return request.get('/data/popular-categories')
}